package com.neusoft.hifly.rpc.attachment.dao;

import java.util.List;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import com.neusoft.hifly.core.pojo.ApiResponse;
import com.neusoft.hifly.rpc.attachment.dao.fallback.FileFallback;
import com.neusoft.hifly.rpc.attachment.domain.FileDTO;

/**
 * Title: 附件服务
 * <p>
 * Description: 附件接口
 * <p>
 * Copyright: Copyright (c) 2008
 * <p>
 * Company: 东软汉枫
 *
 * @author lihui
 * @version 1.0.0
 */
@FeignClient(value = "ctcloud-cbb-attachment", fallbackFactory = FileFallback.class)
public interface IFileDao {

	/**
	 * 查询关联类型和主表ID为条件的记录
	 *
	 * @param objType
	 *            关联类型
	 * @param objLogicId
	 *            关联ID
	 * @param orderBy
	 *            自定义排序
	 * @return 返回附件
	 */
	@RequestMapping(value = "/attachment/api/v1/attachment/obj", method = RequestMethod.GET)
	<T extends List<FileDTO>> ApiResponse<T> findByObjLogicId(@RequestParam("objType") final String objType,
			@RequestParam("objLogicId") final long objLogicId, @RequestParam("orderBy") final String orderBy);

	/**
	 * 通过逻辑ID删除附件
	 *
	 * @param logicId
	 *            附件ID，多id使用英文逗号分隔
	 * @return 成功信息
	 */
	@DeleteMapping(value = "/attachment/api/v1/attachment/{logicId}")
	ApiResponse<?> delete(@PathVariable("logicId") final String logicId) ;
}
